package com.example.SBootDemo.Util;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.List;

public class TxtTransObject {
	static StringBuilder txtValue = new StringBuilder();
	public static void readTxtFile(String filePath){
	        try {
	                InputStreamReader read = new InputStreamReader(new FileInputStream(filePath), "UTF-8");// 考虑到编码格式
	                BufferedReader bufferedReader = new BufferedReader(read);
	                String lineTxt ;
	                while ((lineTxt = bufferedReader.readLine()) != null) {
	                    System.out.println("readTxt:" + lineTxt);
	                    if(lineTxt.equals("")) {
	                    	txtValue.append(lineTxt+"*");
	                    }else {
	                    	txtValue.append(lineTxt);
	                    }
	                    
	                }
	                read.close();
	            }catch (UnsupportedEncodingException e) {
	                e.printStackTrace();
	            } catch (IOException e) {
	                e.printStackTrace();
	            }
	}
	
	
//	public static void main(String[] args) {
//		readTxtFile("C:\\Users\\HP\\Desktop\\DEVICEID-908043175612.txt");
//		//System.out.println(txtValue);
//		String[] String = txtValue.toString().split("\\*");
//		for(int i=0;i<String.length;i++) {
//			System.out.println(String[i]+"\n");
//		}
//	}
}


